package com.hare.common.global.base;

import cn.hutool.core.util.StrUtil;
import lombok.Data;

/**
 * @program: Hare
 * @description: 参数基类
 * @author: Hare
 * @create: 2022-11-03 21:27
 * @Version 6.0.1
 **/
@Data
public class BaseDTO {

    //@ApiModelProperty("id主键")
    private String id;
    //@ApiModelProperty("关键字")
    private String key;
    //@ApiModelProperty("页码")
    private Integer pageIndex;
    //@ApiModelProperty("单页条数")
    private Integer pageSize;


    public Integer getPageIndex() {
        if (pageIndex == null || pageIndex <= 0) {
            return 1;
        }
        return pageIndex;
    }

    public Integer getPageSize() {
        if (pageSize == null || pageSize <= 0) {
            return 15;
        }
        return pageSize;
    }

//    @JsonIgnore
    public boolean isInsert() {
        if (StrUtil.isNotEmpty(id)) {
            return false;
        }
        return true;
    }
}
